package com.ktjy.mapper.user;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class WuBian_3 {
    public static void main(String[] args) {
        try {
            Class lcz=Class.forName("com.ktjy.mapper.user.Employee");
            Constructor constructor=lcz.getDeclaredConstructor();
            Object o=constructor.newInstance();

            Field empNo=lcz.getDeclaredField("empNo");
            Field empName=lcz.getDeclaredField("empName");
            Field empPost=lcz.getDeclaredField("empPost");
            Field empSalary=lcz.getDeclaredField("empSalary");

            empNo.setAccessible(true);
            empName.setAccessible(true);
            empPost.setAccessible(true);
            empSalary.setAccessible(true);

            empNo.set(o,"JD001");
            empName.set(o,"赋值");
            empPost.set(o,"JAva工程师");
            empSalary.set(o,10000);

            Method showInfo=lcz.getDeclaredMethod("showInfo");
            showInfo.invoke(o);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
